import { findResult } from '@/service/join/join.service.js';

const getJoinStatus = (callBack) => {
  let joinStatus = 'null';
  findResult({}, (res) => {
    if (res.status === 0) {
      if (res.data) { // 已申请过加盟
        joinStatus = res.data.status;
        if (res.data.status === 1 && res.data.upgradeRank > 1) { // 审核成功去首页
          uni.showToast({
            title: '已申请加盟！',
            icon: 'none',
            duration: 2000,
            success: () => {
              setTimeout(() => {
                uni.switchTab({
                  url: '/pages/index/index'
                });
              }, 2000);
            }
          });
        }
      }
      callBack && callBack(joinStatus);
    }
  });
};

export {
  getJoinStatus
}